package com.sky.mapper;

import com.sky.aop.AutoFill;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealMappers {
    /**
     * 根据分类id查询套餐的数量
     * @param id
     * @return
     */
    @Select("select count(id) from setmeal where category_id = #{categoryId}")
    Integer countByCategoryId(Long id);
    //新增套餐(day04任务一)
    @AutoFill(OperationType.INSERT)
    void insertSetmeal(Setmeal setmeal);
    //套餐分页查询(day04任务二)
    List<SetmealVO> selectByPageAndName (SetmealPageQueryDTO setmealPageQueryDTO);
    //批量删除套餐(day04任务三)
    @Select("select * from setmeal where id = #{id}")
    Setmeal selectById(Long id);
    //-----------------------------------------------------
    @Delete("delete from setmeal where id = #{id}")
    void deleteById(Long setmealId);
    //修改套餐,首先回显查询之前套餐(day04任务四)
    SetmealVO selectBySetmealId(Long id);
    //修改套餐(day04任务四)
    void updateSetmeal(Setmeal setmeal);


}
